package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class TestController {

    @RequestMapping("/showName")
    public String showName(HttpServletRequest request, HttpServletResponse response)
    {
        //访问传递的参数
        String name = request.getParameter("name");
        System.out.println("查询到的Id："+name);
        return "index";
    }
    @RequestMapping("/showName1")
    public String showName1(HttpServletRequest request, HttpSession session, Model model, ModelMap modelMap)
    {
        System.out.println(request);
        System.out.println(session);
        model.addAttribute("msg","getName");
        System.out.println(model);
        System.out.println(modelMap);
        //访问传递的参数
        String name = request.getParameter("name");
        System.out.println("查询到的Id："+name);
        return "index";
    }

}
